package api_day02;

import java.math.BigDecimal;
import java.math.BigInteger;

/*
    大数类测试
 */
public class BigNumberDemo {
    public static void main(String[] args) {
        BigInteger b1 = new BigInteger("12321548654");
        BigInteger b2 = new BigInteger("16598348654");
        System.out.println(b1.add(b2));
        System.out.println(b1.subtract(b2));
        System.out.println(b1.multiply(b2));
        System.out.println(b1.divide(b2));
        System.out.println("------------------------");
        BigDecimal bd1 = new BigDecimal(234);
        BigDecimal bd2 = new BigDecimal("1234");
        BigDecimal bd3 = new BigDecimal(65478L);
        System.out.println(bd1.add(bd2));
        System.out.println(bd1.subtract(bd2));
        System.out.println(bd1.multiply(bd3));
        System.out.println(bd1.divide(bd3,3,BigDecimal.ROUND_CEILING));
    }
}
